<template>
	<view class="inwardPlan">
		<uni-nav-bar color="#ffffff" background-color="#00aded" :statusBar="true" title="调拨计划" fixed="true" left-icon="left" left-text="返回" @clickLeft="back" />
		<view class="inwardPlan_top">
			<!-- 搜索 -->
			<dil-search :columnData="options.columnDataList" @onSearch="onSearch" v-if="options.columnDataList.length > 0"></dil-search>
		</view>
		<view class="inwardPlan_main">
			<dil-card class="dilCard" @emitEvent="emitEvent" v-bind.sync="options"></dil-card>
		</view>
		<view class="inwardPlan_floot"></view>
	</view>
</template>

<script>
import { mapMutations } from 'vuex';
export default {
	data() {
		return {
			options: {
				requestUrl: '/api/v1/ams/getProductPlanList?apiId=626',
				requestQuery: {},
				cardSlotList: [
					{
						label: '运输详情',
						icon: 'bars',
						emitEvent: 'transOrderDetails',
						showCondition: "['已派车'].includes(item.planStatus)"
					},
					{
						label: '派车',
						icon: 'wlIcon-paicheguanli',
						emitEvent: 'transOrderAdd'
					},
				],
				columnDataList: [],
				totalNum: 0
			}
		};
	},
	onShow() {
		uni.$emit('onShow', 1);
	},
	created() {
		this.initialMap = {
			deleted: 4
		};
		this.options.requestQuery = { ...this.initialMap };
	},
	mounted() {},
	methods: {
		async getOrderSection(data = {}) {},
		onSearch(item) {
			this.options.requestQuery = { ...JSON.parse(JSON.stringify(item)), ...this.initialMap };
		},
		back() {
			uni.switchTab({
				url: '/pages/index/index'
			});
		},
		emitEvent(eventName, cardItem) {
			this[eventName](cardItem);
		},
		transOrderAdd(item) {
			this.updateInwardTransOrderItem(item);
			uni.navigateTo({
				url: '/pages/transOrder/inwardTransOrderAdd'
			});
		},
		transOrderDetails(item) {
			uni.navigateTo({
				url:
					'/pages/transOrder/inwardTransOrder?params=' +
					JSON.stringify({
						planId: item.transPlanId
					})
			});
		},
		//vuex
		...mapMutations('inward', ['updateInwardTransOrderItem'])
	}
};
</script>

<style lang="scss" scoped>
.inwardPlan {
	width: 100vw;
	height: 100%;
	background-color: #f5f5f5;
	&_top {
		background-color: #fff;
	}
	&_main {
	}
	&_floot {
	}
}
</style>
